package com.zmn.plat.persistence.interfaces.extension.serv.category;

import com.zmn.plat.model.entity.extension.serv.category.ExtensionServCategoryAssociation;
import com.zmn.plat.model.entity.extension.serv.category.ExtensionServCategoryAssociationQuery;
import com.zmn.plat.model.vo.extension.serv.category.ExtensionServCategoryAssociationVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author tanghongjun
 * @version v1.0
 * @类说明： 推广分类关联关系DAO
 * @since 2019年12月30日11:47:07
 */
public interface ExtensionServCategoryAssociationDAO {

    /**
     * 描述: ExtensionServCategoryAssociation key 查询数据
     *
     * @param relateId
     * @return: ExtensionServCategoryAssociation
     * @auther: linfeng
     * @since: 2019/12/30 16:41
     */
    ExtensionServCategoryAssociation findByKey(Integer relateId);

    /**
     * 描述:查询最大key
     *
     * @return: relateId
     * @auther: linfeng
     * @since: 2019/12/30 16:41
     */
    Integer findKeyForMax();

    /**
     * 描述: 根据查询条件分页查询
     *
     * @param query
     * @return: List<ExtensionServCategoryAssociation>
     * @auther: linfeng
     * @since: 2019/12/30 16:41
     */
    List<ExtensionServCategoryAssociation> listPageByQuery(ExtensionServCategoryAssociationQuery query);

    /**
     * 描述: 根据查询条件查询所有数据
     *
     * @param query
     * @return: List<ExtensionServCategoryAssociation>
     * @auther: linfeng
     * @since: 2019/12/30 16:41
     */
    List<ExtensionServCategoryAssociation> listByQuery(ExtensionServCategoryAssociationQuery query);

    /**
     * 描述: ExtensionServCategoryAssociation 数据
     *
     * @return: List<ExtensionServCategoryAssociation>
     * @auther: linfeng
     * @since: 2019/12/30 16:41
     */
    List<ExtensionServCategoryAssociation> listAll();

    /**
     * 描述: 根据前台分类ID查询后台分类关联关系，参数不能同时为空
     *
     * @param extensionServCategId 推广服务分类ID
     * @param extensionCategId  推广分类ID
     * @param categId     后台二级产品分类ID
     * @return List<ExtensionServCategoryAssociationVO> 推广分类关联关系
     * @auther linfeng
     * @since 2019/12/30 11:20
     */
    List<ExtensionServCategoryAssociationVO> listByExtensionServCategoryId(@Param("extensionServCategId") Integer extensionServCategId, @Param("extensionCategId") Integer extensionCategId, @Param("categId") Integer categId);

    /**
     * 描述: 根据查询条件统计满足条件的数据条数
     *
     * @param query
     * @return: Integer
     * @auther linfeng
     * @since 2019/12/30 11:20
     */
    Integer countByQuery(ExtensionServCategoryAssociationQuery query);

    /**
     * 描述: 根据主键修改数据
     *
     * @param extensionServCategoryAssociation
     * @return: 执行结果码
     * @auther linfeng
     * @since 2019/12/30 11:20
     */
    Integer updateByKey(ExtensionServCategoryAssociation extensionServCategoryAssociation);


    /**
     * 描述: 新增数据
     *
     * @param extensionServCategoryAssociation
     * @return: 执行结果码
     * @auther linfeng
     * @since 2019/12/30 11:20
     */
    Integer insert(ExtensionServCategoryAssociation extensionServCategoryAssociation);

    /**
     * 批量插入前后台产品关联关系
     * @param extensionServCategoryAssociationList
     * @auther linfeng
     * @since 2019/12/30 11:20
     */
    Integer insertBatch(List<ExtensionServCategoryAssociation> extensionServCategoryAssociationList);

    /**
     * 描述: 根据主键删除数据
     *
     * @param relateId
     * @return: 执行结果码
     * @auther linfeng
     * @since 2019/12/30 11:20
     */
    Integer deleteByKey(Integer relateId);

    /**
     * 根据前台服务id,前台以及产品id,前台二级产品id删除对应后台关联的关联关系
     * @param extensionServCategId
     * @param extensionCategId
     * @return
     */
    Integer deleteByExtensionServCategId(@Param("extensionServCategId") Integer extensionServCategId, @Param("extensionCategId") Integer extensionCategId);

    /**
     * 通过推广服务分类ID和推广分类ID批量删除推广分类关联关系
     * @param ids
     * @return
     */
    Integer deleteByServCategIdAndExtensionCategId(String[] ids);

}
